/**
 * 1.该文件,用于统一管理项目中的ajax请求
 * 2.服务器上的每一个接口,在该文件中都对应一个请求函数
 * 3.该文件中,所有的命名规范都是:reqxxx
 */
import ajax from './ajax'
import Majax from './Majax'//模拟数据

 //该函数专门用于请求三级分类信息，以后谁想获取三级分类数据，谁就调用该函数
export const reqCategoryList = () => ajax.get('/product/getBaseCategoryList');
//获取轮播图数据
export const reqRollPlayList = () => Majax.get('/rollplay')
//获取楼层数据
export const reqFloorList = () => Majax.get('/floor')
//获取搜索数据
export const reqSearchInfo = (params) => ajax.post('/list',params)
//获取商品详情的数据
export const reqGoodDetailList = (skuId) => ajax.get(`/item/${skuId}/`)
//用于添加商品到购物车,修改购物车中已有的商品数据
export const reqAddOrUpdateCart = (skuId,skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)
//获取购物车数据
export const reqCartList = () => ajax.get('/cart/cartList')
//请求勾选购物车
export const reqCheckSkuInCart = (skuId,isChecked) => ajax.get(`/cart/checkCart/${skuId}/${isChecked}`)
//请求全选 购物车
export const reqCheckAllSkuInCart = (skuIdList,isChecked) => ajax.post(`/cart/batchCheckCart/${isChecked}`,skuIdList)
//请求删除购物车中的商品
export const reqDeleteSkuInCart = (skuId) => ajax.delete(`/cart/deleteCart/${skuId}`)
//请求批量删除购物车中的商品 请求体的数据在第二个参数上
export const reqBatchDeleteSkuInCart = (skuIdList) => ajax.delete(`/cart/batchDeleteCart`,{data:skuIdList})
//获取验证码
export const reqVerifyCode = (phone) => ajax.get(`/user/passport/sendCode/${phone}`)
//用于注册
export const reqRegister =(params) => ajax.post(`/user/passport/register`,params)
//用于登录
export const reqLogin =(params) => ajax.post('/user/passport/login',params)
//请求当前用户登录的信息(通过token,token在请求头上)
export const reqUserInfo = () => ajax.get('/user/passport/auth/getUserInfo')
//用户退出登录
export const reqUserLogout = () => ajax.get('/user/passport/logout')